package com.samecity.mvp.presenter.LoginPresenter;

import android.content.Context;

import com.samecity.mvp.base.BasePresenter;
import com.samecity.mvp.model.loginModel.LoginModel;
import com.samecity.mvp.view.activity.loginActivity.LoginView;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.openapi.IWXAPI;


public class LoginPresenter extends BasePresenter<LoginView> {
    private LoginModel loginModel;
    public LoginPresenter(LoginModel loginModel) {
        this.loginModel = loginModel;
    }
    @Override
    public void onCreate() {
        mView.initViewData();
    }

    @Override
    public void loadData() {

    }

    public void Login(Context context){
        loginModel.userLogin(context,"","",null);
    }

    public void WXLogin(IWXAPI wxapi){
        if( !wxapi.isWXAppInstalled()){
     //       mView.showMessageDada("请先安装微信应用");
            return ;
        }

        if( !wxapi.isWXAppSupportAPI() ){
       //     mView.showMessageDada("请先更新微信应用");
            return ;
        }

      //  wxapi.registerApp(KeepData.APP_ID);
        final SendAuth.Req req = new SendAuth.Req();
    //    req.scope =KeepData.WX_LOGIN_SCOPE ;
    //    req.state = KeepData.WX_LOGIN_STATE;
        wxapi.sendReq(req);

    }
}
